package me.softwareengineer.guice.rendering.domain;

import java.util.List;

import me.softwareengineer.guice.rendering.listener.EndListItemEvent;
import me.softwareengineer.guice.rendering.listener.Listener;
import me.softwareengineer.guice.rendering.listener.StartListItemEvent;

/**
 * Represents an item element in {@link ListElement}
 * 
 * @author yad.tahir
 * 
 *         <pre>
 * This class is thread-safe and can be cached/re-used and used concurrently.
 * </pre>
 */
public class ListItemElement extends Element {

	/**
	 * Create a list item element
	 * 
	 * @param children
	 */
	public ListItemElement(List<Element> children) {
		super(children);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void afterElement(Listener listener) {
		EndListItemEvent e = new EndListItemEvent();
		listener.onEvent(e);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void beforeElement(Listener listener) {
		StartListItemEvent e = new StartListItemEvent();
		listener.onEvent(e);
	}
}
